<template>
	<view>
		<view class="report-detail-page">
			<!-- 基础信息 -->
			<info-card :report-detail="reportData"></info-card>

			<!-- 结果和描述 -->
			<detail-result :repot-detail="reportDetail" v-if="reportData.medicalType === '05'"></detail-result>

			<!-- 项目表格 -->
			<project-table :repotDetail="reportDetail" v-if="reportData.medicalType === '06'"></project-table>
		</view>
	</view>
</template>

<script>
	import infoCard from './components/Report/infoCard.vue'
	import projectTable from './components/Report/projectTable.vue'
	import detailResult from './components/Report/detailResult.vue'
	import {
		medicalTechnologyReportCheckResult,
		medicalTechnologyReportTestResult
	} from '../../../api/medicalTechnologyReport'
	export default {
		components: {
			infoCard,
			projectTable,
			detailResult
		},
		data() {
			return {
				reportDetail: {},
				applyBillNo: '',
				reportData: {},
			}
		},
		onLoad: function(e) {
			this.reportData = JSON.parse(e.item)
			this.applyBillNo = this.reportData.reportBillNo
			this.init()
		},
		methods: {
			init() {
				console.log(this.reportData)
				if (this.reportData.medicalType == "05") {
					medicalTechnologyReportCheckResult({
						applyBillNo: this.applyBillNo
					}).then(res => {
						console.log(res)
						if (res.length > 0) {
							this.reportDetail = res[0];
						}

					})
				} else if (this.reportData.medicalType == "06") {
					medicalTechnologyReportTestResult({
						applyBillNo: this.applyBillNo
					}).then(res => {
						console.log(res)
						if (res.length > 0) {
							this.reportDetail = res[0];
						}

					})
				}

			}
		}
	}
</script>

<style lang="scss" scoped>
	.report-detail-page {
		background: linear-gradient(#e0f3ff 0%, #fff 30%);
		min-height: 100vh;
		padding: 20rpx;
	}
</style>